#include <iostream>
#include <vector>
#include <cstdio>
#include <cstring>
using namespace std;
int main() {
    int T;
    scanf("%d", &T);
    char s[10000];
    int len, res;
    int tmp;
    int o, p;
    while (T--) {
        scanf("%s", s);
        len = strlen(s);
        res=0;
        for (int i=1; i<=len; i++) {
            if (s[i-1]=='y') {
                for (int j=2; ; j++) {
                    if (j*j*i>len && (float)i/(float)(j*j)<1) break;
                    if (j*j*i<=len) {
                        if (s[i*j-1]=='r' && s[i*j*j-1]=='x') res++;
                    }
                    if (i%(j*j)==0) {
                        if (s[i/j-1]=='r' && s[i/(j*j)-1]=='x') res++;
                    }
                }
            }
        }
        printf("%d\n", res);
    }
    return 0;
}
